package cn.iocoder.yudao.module.polling.dal.mysql.pollingstandard;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.polling.dal.dataobject.pollingstandard.PollingStandardDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.polling.controller.admin.pollingstandard.vo.*;

/**
 * 巡检标准 Mapper
 *
 * @author 左达成
 */
@Mapper
public interface PollingStandardMapper extends BaseMapperX<PollingStandardDO> {

    default PageResult<PollingStandardDO> selectPage(PollingStandardPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<PollingStandardDO>()
                .eqIfPresent(PollingStandardDO::getCreator, reqVO.getCreator())
                .betweenIfPresent(PollingStandardDO::getCreateTime, reqVO.getCreateTime())
                .eqIfPresent(PollingStandardDO::getUpdater, reqVO.getUpdate())
                .eqIfPresent(PollingStandardDO::getPollingCode, reqVO.getPollingCode())
                .likeIfPresent(PollingStandardDO::getPollingName, reqVO.getPollingName())
                .eqIfPresent(PollingStandardDO::getDeptId, reqVO.getDeptId())
                .eqIfPresent(PollingStandardDO::getAddDemand, reqVO.getAddDemand())
                .eqIfPresent(PollingStandardDO::getRemark, reqVO.getRemark())
                .orderByDesc(PollingStandardDO::getId));
    }

    default List<PollingStandardDO> selectList(PollingStandardExportReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<PollingStandardDO>()
                .eqIfPresent(PollingStandardDO::getCreator, reqVO.getCreator())
                .betweenIfPresent(PollingStandardDO::getCreateTime, reqVO.getCreateTime())
                .eqIfPresent(PollingStandardDO::getUpdater, reqVO.getUpdate())
                .eqIfPresent(PollingStandardDO::getPollingCode, reqVO.getPollingCode())
                .likeIfPresent(PollingStandardDO::getPollingName, reqVO.getPollingName())
                .eqIfPresent(PollingStandardDO::getDeptId, reqVO.getDeptId())
                .eqIfPresent(PollingStandardDO::getAddDemand, reqVO.getAddDemand())
                .eqIfPresent(PollingStandardDO::getRemark, reqVO.getRemark())
                .orderByDesc(PollingStandardDO::getId));
    }

    List<PollingStandardQueryVo> selectPollingStandardMList(PollingStandardQueryVo pollingStandardQueryVo);

}
